 #include<reg51.h>
 #include<stdio.h>
#include<string.h>
 #define LCD_clear() LCD_command(0x01)	/* Clear display LCD */
 #define LCD_origin() LCD_command(0x02)	/* Set to origin LCD */
 #define LCD_row1() LCD_command(0x80)	/* Begin at Line 1 */
 #define LCD_row2() LCD_command(0xC0) 
  


//sbit rel1=P1^0;
sbit rs =P3^6;
//sbit rw = P2^6;
sbit en =P3^7;
static int d1=0,d2=0,d3=0,d4=0;
void lcd_en ()
{
//		rw=0;
		en  = 1; en  = 1; en  = 1;
      en  = 0; en  = 0;
}
void LCD_delay(unsigned char ms)
{
	unsigned int n;
	unsigned int i;
	for (n=0; n<ms; n++)
	{
		for (i=0; i<1535; i++); /* For 1 ms */
	}
    
}
 
void LCD_command(unsigned char command)
{
    //  rw=0;
      rs=0; rs = 0;
  	   P2		= command;
  	   lcd_en ();
      LCD_delay(5);

}

void LCD_init()
 {
 	//   rw=0;
 	   LCD_command(0x38);
 	   LCD_command(0x06);
 	   LCD_command(0x0c);
 	   LCD_command(0x01);
      LCD_delay(10);
 }
 
void LCD_putc(unsigned char ascii)
{     
 //    rw=0;
 		rs=1;
  	   P2		= ascii;
  	   lcd_en ();
      LCD_delay(5);
//      LCD_command(0x0C);
}

void dish1()
 {
   LCD_row1();
   LCD_puts("DISH-1");
 }
 void dish2()
 {
   LCD_row1();
   LCD_puts("DISH-2");
 }
 void dish3()
 {
   LCD_row1();
   LCD_puts("DISH-3");
 }
 void dish4()
 {
   LCD_row1();
   LCD_puts("DISH-4");
 }
  

void LCD_puts(unsigned char *lcd_string)
{
	while (*lcd_string) 
	{
		LCD_putc(*lcd_string++);
	}
}

void main()
 {
/* rel1=0;
 LCD_delay(100);
  rel1=1;*/
   LCD_init();
   
  while(1)
   {
    
   LCD_row1();
   LCD_puts("HEXsource");
   while(1);
   } 	
  
	 



 
             

 
   
     

